import pandas as pd

df = pd.read_csv('过滤.csv', encoding='gbk')

def toRowDf(row):
    rowDf = row.to_frame()
    rowDf = pd.DataFrame(rowDf.values.T, columns = rowDf.index)
    return rowDf

DfMap = {}
for index, row in df.iterrows():
    RIDtype = row['TYPE']
    if not RIDtype in DfMap.keys():
        DfMap[RIDtype] = {}
    DfMapI = DfMap[RIDtype]
    RID = row['RID']
    if not RID in DfMapI.keys():
        DfMapI[RID] = pd.DataFrame(columns=df.columns)
    DfMapI[RID] = pd.concat([DfMapI[RID], toRowDf(row)])

for RIDtype,d in DfMap.items():
    for RID, RIDdf in d.items():
        if RIDdf.shape[0]>1:
            print(RID, ',', RIDdf.shape[0], ',', RIDtype)
    print()